import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Cookie from 'js-cookie'


// 引入element-ui样式
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'  // 注意样式文件需要单独引入
import 'element-ui/lib/index.js'
// 调用插件
Vue.use(ElementUI)

import axios from "axios";

Vue.prototype.$axios = axios

axios.defaults.baseURL = '/api'  //注意修改地址


Vue.config.productionTip = false

axios.interceptors.request.use(
  config => {
      
      if (Cookie.get("token")) {
        config.headers.Token = Cookie.get("token")
      }
      return config;
  },
  function(err) {
      console.log("失败信息" + err);
  }
);

new Vue({
  router,
  store,
  render: h => h(App),
  beforeCreate(){
    Vue.prototype.$bus = this //安装全局事件总线
  }
}).$mount('#app')
